﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using TKFA.BLL;

namespace FixedAssets.Module.CheckFA
{
    public partial class FA_CheckQuery : System.Web.UI.Page
    {
        TKFA.BLL.FA_CHECKPLAN checkplan = new FA_CHECKPLAN();
        static DataTable DT;
        static DataTable ALLDT;
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            DT = checkplan.GetCheckPlanValue();
            ALLDT = DT;
            foreach (DataRow dr in DT.Rows)
            {
                if (dr["STATUS"].Equals("1"))
                {
                    dr["STATUS"] = "已通过";
                }
                else
                {
                    dr["STATUS"] = "未通过";
                }
            }
            this.C1GridView1.DataSource = DT;
            this.C1GridView1.DataBind();
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (this.DropDownList1.SelectedValue)
            { 
                case"0":
                     this.C1GridView1.DataSource = DT;
                     this.C1GridView1.DataBind();
                    break;
                case "1":
                    {
                        DataView dv =DT.DefaultView;
                        dv.RowFilter = " STATUS='已通过'";
                        this.C1GridView1.DataSource = null;
                        this.C1GridView1.DataSource = dv.ToTable();
                        this.C1GridView1.DataBind();
                    }
                    break;
                case "2":
                    {
                        DataView dv = DT.DefaultView;
                        dv.RowFilter = " STATUS='未通过'";
                        this.C1GridView1.DataSource = null;
                        this.C1GridView1.DataSource = dv.ToTable();
                        this.C1GridView1.DataBind();
                    }
                    break;            
            }
        }
    }
}